home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 12 / QRZ Ham Radio Callsign Database - Volume 12.iso / unix / hpux / link_qrz.hp < prev    next >
Text File  |  1998-11-11  |  1KB  |  41 lines

  1. #!/bin/ksh
  2. #
  3. # Script to create a directory on hard disk with links pointing to files
  4. # on CD-ROM, converting UPPER.CSE;1 files to lower.cse symbolic links.
  5. #
  6. # Usage:    symlink.scr [CD-ROM directory start] [HD directory start]
  7. #
  8. if [[ $# -ne 2 ]]
  9. then
  10.     echo This script attempts to create a directory tree that mirrors
  11.     echo the tree specified, but contains only lower-case filenames,
  12.     echo and omits any ;1 version numbers that may be present in the
  13.     echo file name.  This is useful to make lower-case pointers to
  14.     echo a CD-ROM mounted on an HP-UX system, which mounts the disk
  15.     echo with upper case filenames, and the version number.
  16.     echo
  17.     echo Usage: $0 [absolute CD-ROM directory] [HD directory]
  18.     echo ie: $0 /mnt/cdrom/CALLBK callbk
  19.     exit 1
  20. fi
  21.  
  22. if [[ ! -d /$1 ]]
  23. then
  24.     echo "$1 must be an absolute directory path (starting with '/')"
  25.     exit 1
  26. fi
  27.  
  28. if [[ ! -d $2 ]]
  29. then
  30.     if mkdir $2
  31.     then
  32.     echo Failed to create directory ${2}!
  33.     exit 1
  34.     fi
  35. fi
  36.  
  37. for i in $1/*\;1
  38. do
  39.     ln -s ${i} ${2}/$(basename ${i} \;1 | tr [[:upper:]] [[:lower:]])
  40. done
  41.